#!/usr/bin/perl -ws
@declaration = ();
$type = "";
$first_declare = 1;
if (defined ($line = <>)) {
  $declaration [@declaration] = $line;
  $new_line = &mod_line ($line);
  ($method, $declare) = split (/\(/, $new_line);
  print "  /**\n";
  print "   *\n";
  ($type, $method_name) = split (/ /, $method);
  if (defined ($method_name) && ($method_name ne "")) {
    print "   *\n";
  } else {
    if ($line !~ /void/) {
      print "   * Constructor\n";
    };
  };
  @declarations = split (/,/, $declare);
  for ($i = 0; $i < @declarations; $i++) {
    $declare = $declarations [$i];
    $declare = &mod_line ($declare);
    &proc_declare;
  };
};
while (defined ($line = <>)) {
  #Save declaration.
  $declaration [@declaration] = $line;
  $line = &mod_line ($line);
  @declarations = split (/,/, $line);
  for ($i = 0; $i < @declarations; $i++) {
    $declare = $declarations [$i];
    $declare = &mod_line ($declare);
    &proc_declare;
  };
};
if (defined ($type) && ($type ne "") && defined ($method_name) &&
      ($method_name ne "")) {
  print "   * \@return    $type\n";
};
print "   * \@author Irv Bunton\n";
print "   */\n";
for ($i = 0; $i < @declaration; $i++) {
  print $declaration [$i];
};
sub mod_line
{
  my ($parm_line) = @_;
  $parm_line =~ s/^[\t ]*//g;
  $parm_line =~ s/[\t ]*[\r\n]*$//g;
  $parm_line =~ s/[\t ][\t ]*/ /g;
  $parm_line =~ s/final *//;
  $parm_line =~ s/public *//;
  $parm_line =~ s/private *//;
  $parm_line =~ s/protected *//;
  $parm_line =~ s/static *//;
  $parm_line =~ s/synchronized *//;
  $parm_line =~ s/void *//;
  return ($parm_line);
}
sub proc_declare
{
  ($declare_type, $param) = split (/ /, $declare);
  if (defined ($param) && ($param ne "")) {
    if ($first_declare) {
      $first_declare = 0;
      print "   * \@param ";
	} else {
      print "   * \@param ";
    };
    $param =~ s/\)//g;
    $param =~ s/\,//g;
    print "$param\n";
  };
}
exit 0;
print "$declare_type\n";
